package com.yhy.dubbo.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yhy.domain.Question;
import com.yhy.dubbo.api.QuestionApi;
import com.yhy.mapper.QuestionMapper;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

@Service
public class QuestionApiImpl implements QuestionApi {

    @Autowired
    private QuestionMapper questionMapper;

    @Override
    public Question findQuestionByUid(Long id) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("user_id",id);
        return questionMapper.selectOne(queryWrapper);
    }

    @Override
    public void update(Question question) {
        questionMapper.updateById(question);
    }

    @Override
    public void save(Question question) {
        questionMapper.insert(question);
    }
}